import 'package:flutter/material.dart';

class IntoWareHousingItem extends StatefulWidget {
  dynamic data;
  int index;
  Function(String id, String name) onTapFuns;
  IntoWareHousingItem(this.data, this.index, this.onTapFuns);

  @override
  State<StatefulWidget> createState() {

    return IntoWareHousingItemState();
  }


}

class IntoWareHousingItemState extends State<IntoWareHousingItem> {
  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      child: Container(
        margin: EdgeInsets.only(top: 6),
        padding: EdgeInsets.all(10),
        color: Colors.white,
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: <Widget>[
            Row(
              children: <Widget>[
                Expanded(
                    child: Column(
                      crossAxisAlignment: CrossAxisAlignment.start,
                      children: <Widget>[
                        Padding(
                          padding: EdgeInsets.only(bottom: 6),
                          child: _Text("项目: ${widget.data["projectname"]}"),
                        ),
                        RichText(
                          text: TextSpan(
                            text: "入库任务单号：",
                            style:
                            TextStyle(fontSize: 14.0, color: Color(0xff646464)),
                            children: <TextSpan>[
                              TextSpan(
                                text: "${widget.data["orderno"]}",
                                style: TextStyle(
                                    fontSize: 14.0, color: Color(0xFF00A5F1)),
                              ),
                            ],
                          ),
                        ),
                        Padding(
                          padding: EdgeInsets.only(top: 6),
                          child: _Text("计划入库物资种数：${widget.data["skucount"] ?? "0"}"),
                        ),
                        Padding(
                          padding: EdgeInsets.only(top: 6, bottom: 6),
                          child: _Text("计划入库物资总数：${widget.data["materialcount"] ?? "0"}"),
                        ),
                      ],
                    )),
                Center(
                  child: Container(
                    width: 8,
                    height: 16,
                    child: Image.asset("assets/images/arrow.png"),
                  ),
                )
              ],
            ),
            Container(
              width: double.infinity,
              height: 1,
              color: Color(0xffeeeeee),
            ),
            Row(
              children: <Widget>[
                Expanded(
                    child: Padding(
                      padding: const EdgeInsets.only(top: 10),
                      child: Text(
                        "${widget.data["orderstatetypename"]}",
                        style: TextStyle(color: Color(0xFF00A5F1)),
                      ),
                    )),
                Padding(
                  padding: EdgeInsets.only(top: 10),
                  child: _Text("${widget.data["applytime"]??""}"),
                )
              ],
            ),
          ],
        ),
      ),
      onTap: () {
        if (widget.onTapFuns != null) {
          widget.onTapFuns(widget.data["id"], widget.data["orderstatetypename"]);
        }
      },
    );
  }

}

class _Text extends Text {
  TextStyle style;

  _Text(String data,
      {this.style = const TextStyle(color: Color(0xff646464), fontSize: 14)})
      : super(data, style: style);
}